home *** CD-ROM | disk | FTP | other *** search
- /*
- File: SimpleFormatUIWin.c
-
- Copyright 1993-6, Adobe Systems Incorporated.
- All rights reserved.
-
- C source file for MS-Windows specific code for SimpleFormat Plug-In
- */
-
- #include "SimpleFormat.h"
- #include "WinDialogUtils.h"
-
- /*
- #include "PITypes.h"
- #include "PIgeneral.h"
- #include "PIAbout.h"
- #include "FormatUtilities.h"
-
- #include <windows.h>
-
- #include <stdlib.h>
- #include "errno.h"
- #include "string.h"
-
- #include "WinUtil.h"
- */
-
- /*****************************************************************************/
-
- //BOOL WINAPI FormatProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam);
-
- /*****************************************************************************/
-
- void DoAbout (GPtr globals)
- {
- ShowAbout((AboutRecordPtr)gStuff, hDllInstance, AboutID);
- }
-
- /*****************************************************************************/
-
- /* File I/O Routines. */
-
- OSErr FSWrite(int32 refNum, long *count,void *buffPtr)
- {
- /* Note: this routine doesn't work for data larger than 64k. */
-
- WORD bytes;
-
- bytes = (WORD)*count;
- if ((*count = _lwrite((int)refNum,(LPSTR)buffPtr,bytes))==0xffff)
- return writErr;
-
- return noErr;
- }
-
-
- OSErr SetFPos (int32 refNum, short posMode, long posOff)
- {
- _llseek((int)refNum, posOff, posMode);
- return noErr; // just for samples sake. should return error value based on __llseek's
- }
-
- OSErr FSRead(int32 refNum, long *count , void *buffPtr)
- {
- WORD bytes;
-
- bytes = (WORD) *count;
-
- if ((*count = _lread((int)refNum,(LPSTR)buffPtr,bytes))==0xffff)
- return readErr;
-
- return noErr;
- }
-
- /****************************************************************************/
- /* Example for ShowAlert() function which takes a string ID as parameter */
- /* and displays a message box */
- /****************************************************************************/
-
- short ShowAlert (short stringID)
- {
- char szMessage[256];
- char szTitle[128];
-
- LoadString(hDllInstance, stringID, szMessage, sizeof szMessage);
- LoadString(hDllInstance, 2, szTitle, sizeof szTitle);
- return ( MessageBox(NULL, szMessage, szTitle, MB_OK | MB_ICONHAND) );
-
- }
-
-
- /* Initialization and termination code for window's dlls. */
-
- // Win32 Change
- #ifdef WIN32
-
- // Every 32-Bit DLL has an entry point DLLInit
-
- BOOL APIENTRY DLLInit(HANDLE hInstance, DWORD fdwReason, LPVOID lpReserved)
- {
-
- if (fdwReason == DLL_PROCESS_ATTACH)
- hDllInstance = hInstance;
-
- return TRUE; // Indicate that the DLL was initialized successfully.
- }
-
- #else
- /* ------------------------------------------------
- * Code from Borland's window's dll example code.
- * ------------------------------------------------
- */
- #if defined(__BORLANDC__)
- // Turn off warning: Parameter '' is never used; effects next function only
- #pragma argsused
- #endif
-
- // Every DLL has an entry point LibMain and an exit point WEP.
- int FAR PASCAL LibMain( HANDLE hInstance, WORD wDataSegment,
- WORD wHeapSize, LPSTR lpszCmdLine )
- {
- // Required when using Zortech; causes blink to include startup code
- extern __acrtused_dll;
-
- // The startup code for the DLL initializes the local heap (if there is one)
- // with a call to LocalInit which locks the data segment.
- if ( wHeapSize != 0 )
- UnlockData( 0 );
-
- hDllInstance = hInstance;
- return 1; // Indicate that the DLL was initialized successfully.
- }
-
- int FAR PASCAL WEP(int nParam)
- {
- switch (nParam) {
- case WEP_SYSTEM_EXIT: // System shutdown in progress
- case WEP_FREE_DLL : // DLL use count is 0
- default : // Undefined; ignore
- return 1;
- }
- }
- #endif
-
-
-